package org.dingyom.gift.controller;

import net.bytebuddy.asm.Advice;
import org.dingyom.gift.dto.SmsDto;
import org.dingyom.gift.service.ISmsService;
import org.dingyom.gift.util.AjaxResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.validation.Valid;
import javax.xml.ws.Action;

@RestController
@RequestMapping("/sms")
public class SmsController {

    /**
     * 发送手机注册验证码
     */
    @Autowired
    private ISmsService smsService;
    @PostMapping("/sendSms")
    public AjaxResult sendSms(@RequestBody String tel){
        return smsService.sendSms(tel);
    }
    //登陆验证码 TODO

    //找回密码验证码 TODO

    /**
     * 校验验证码
     * @param dto
     * @return
     */
    @PostMapping("/verify")
    public AjaxResult verify(@RequestBody @Valid SmsDto dto){
        return smsService.verify(dto);
    }
}
